﻿@{
    ViewBag.Title = "充值记录";
}
<div class="pageheader">
    <div class="page-bar">
        <ul class="page-breadcrumb">
            <li><a href="javascript:;"><i class="iconfont icon-home1"></i> 首页</a> </li>
            <li><a href="javascript:;">会员管理</a> </li>
            <li><a href="javascript:;">充值记录</a> </li>
        </ul>
    </div>
</div>
<div class="layui-fluid">
    <div class="layui-card layui-tab">
        <div class="layui-card-body table-tool-mini">
            <div class="layui-form toolbar">
                <div class="layui-form-item">
                    <div class="menu-list">
                        <div class="layui-inline">
                            <div class="layui-input-inline mr0">
                                <input id="txtKeywords" class="layui-input" type="text" placeholder="输入关键字" />
                            </div>
                        </div>
                        <div class="layui-inline">
                            <button class="layui-btn icon-btn layui-btn-normal layui-btn-sm" id="btnSearchAuth" data-type="btnSearch">
                                <i class="layui-icon">&#xe615;</i>搜索
                            </button>
                        </div>
                    </div>
                    <div class="layui-inline">
                        <div class="layui-btn-group">
                            <a class="layui-btn icon-btn layui-btn-normal layui-btn-sm" href="../users/recharge_edit"><i></i><i class="iconfont icon-close1"></i><span> 充值</span></a>
                            <a data-type="btnDelete" class="layui-btn icon-btn layui-btn-normal layui-btn-sm"><i class="iconfont icon-delete"></i><span> 删除</span></a>
                        </div>
                    </div>
                </div>
            </div>
            <table class="layui-table" lay-data="{page:true, id:'ltable'}" lay-filter="ltable">
                <thead>
                    <tr>
                        <th lay-data="{checkbox:true}"></th>
                        <th lay-data="{field:'user_name'}">用户名</th>
                        <th lay-data="{field:'recharge_no'}">订单号</th>
                        <th lay-data="{field:'payment'}">支付方式</th>
                        <th lay-data="{field:'amount', templet: '#amount'}">金额</th>
                        <th lay-data="{field:'status',templet: '#status'}">状态</th>
                        <th lay-data="{field:'add_time'}">生成时间</th>
                        <th lay-data="{templet: '#barDemo'}">操作</th>
                    </tr>
                </thead>
            </table>
        </div>
    </div>
</div>
<script type="text/html" id="amount">
    {{#  if(d.amount>0){ }}
    +
    {{#  } }}
    {{d.amount}}
</script>
<script type="text/html" id="status">
    {{#  if(d.status==1){ }}
    已完成({{d.complete_time}})
    {{#  } else{ }}
    未完成
    {{#  } }}
</script>
<script type="text/html" id="barDemo">
    <a href="../users/recharge_edit?username={{d.user_name}}" class="layui-btn layui-btn-xs"><i class="fa fa-eye"></i> 充值</a>
</script>
@section Scripts{
    <script type="text/javascript">
        layui.use(['table', 'cmswh'], function () {
            var table = layui.table, form = layui.form, cmswh = layui.cmswh, $ = layui.jquery;
            cmswh.dataBind('RechargeList');
            var active = {
                btnDelete: function () {
                    cmswh.batOperate('RechargeDelete', 'id');
                },
                btnSearch: function () {
                    table.reload('ltable', { page: { curr: 1 }, where: getcond() });
                }
            };
            $('.layui-inline .layui-btn').on('click', function () {
                var type = $(this).data('type');
                active[type] ? active[type].call(this) : '';
            });
            /*拼接条件返回postdata*/
            function getcond() {
                var keywords = $("#txtKeywords").val();
                var postdata = { keywords: keywords };
                return postdata;
            }
        });
    </script>
}